import java.io.FileReader;
import java.io.FileWriter;
import java.io.BufferedWriter;

import java.io.FileNotFoundException;
import java.io.IOException;

public class Main
{
	public static void main(String[] args)
	{
		int count = 0;
		try
		{
//			FileReader fis  = new FileReader("c:\\data.txt");
			FileReader fr = new FileReader("data.txt");
			BufferedWriter bw = new BufferedWriter(new FileWriter("sample.txt"));

			while(true)
			{
				count = fr.read();
				if(count == -1)
					break;
				System.out.print((char)count);
				bw.append((char)count);
			}
			bw.close();
			System.out.println();
		}
		catch (FileNotFoundException e)	{
			e.printStackTrace();
		}
		catch (IOException e) {
			e.printStackTrace();
		}
	}
}
